<?php

class testAction extends CommonAction
{


    public function index()
    {
        $mailto="2636966314@qq.com";
        $mailtitle="a letter from qiye qq";
        $mailcontent="this is mail content".date("Y-m-d H:i:s");
        $mailfrom="www.sina.com";

        $this->email($mailto,$mailfrom,$mailto,$mailcontent);
        echo "mail send ok".date("Y-m-d H:i:s");

    }
    public function _empty()
    {
        //空操作
        $this->error("您访问的页面不存在！");
    }

    /*
     * 邮件发送
     * @param string $to 收件人邮箱，多个邮箱用,分开
     * @param string $mailfrom 发件人邮箱
     * @param string $title 标题
     * @param string $content 内容
     */

    public function email($to, $mailfrom, $title, $content)
    {
        import("@.ORG.Util.mail"); //导入邮件类，在附件里面
        //邮件相关变量
        $cfg_smtp_server = 'smtp.qq.com';
        $cfg_ask_guestview = '8';
        $cfg_smtp_port = '25';
        $cfg_ask_guestanswer = '8';
        $cfg_smtp_usermail = '2355621408@qq.com'; //你的QQ邮箱
        $cfg_smtp_user = '2355621408'; //你的QQ号
        $cfg_smtp_password = '@YiShang888'; //你的QQ密码

        $smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
        $smtp->debug = false;

        $mailtitle = $title; //邮件标题
        $mailbody = $content; //邮件内容
        //$to 多个邮箱用,分隔
        $mailtype = 'TXT';
        $smtp->sendmail($to, $mailfrom, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
    }

}

?>